From c2601841bad005aac54556ceb26c44902f571d5f Mon Sep 17 00:00:00 2001 From: robertlipe Date: Tue, 31 Dec 2013 01:23:58 +0000 Subject: [PATCH] A further beatdown on binary option handling in the GUI. I think it finally works sensibly now. --- gpsbabel/gui/mainwindow.cc | 8 +++++--- gpsbabel/gui/optionsdlg.cc | 6 ++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gpsbabel/gui/mainwindow.cc b/gpsbabel/gui/mainwindow.cc index f77d88586..63fe218b6 100644 --- a/gpsbabel/gui/mainwindow.cc +++ b/gpsbabel/gui/mainwindow.cc @@ -27,6 +27,7 @@ #include #include #include +// #include #include "mainwindow.h" #include "../gbversion.h" @@ -112,11 +113,12 @@ static QString MakeOptions(const QList& options) QString str; for (int i = 0; i< options.size(); i++) { FormatOption option = options[i]; + QVariant default_value = option.getDefaultValue(); if (option.getSelected()) { // For OPTbool, 'selected' is the key, not value. if (option.getType() == FormatOption::OPTbool) { // Only write "foo=1" if that's not already the default. - if (option.getDefaultValue() != "1") { + if (default_value != "1") { str += "," + option.getName() + "=1"; } } else { @@ -127,8 +129,8 @@ static QString MakeOptions(const QList& options) // turn it off here, but only if the default isn't zero // or given. if (option.getType() == FormatOption::OPTbool && - option.getDefaultValue() != "0" && - option.getDefaultValue() != "") { + default_value != "0" && + default_value != "") { str += "," + option.getName() + "=0"; } } diff --git a/gpsbabel/gui/optionsdlg.cc b/gpsbabel/gui/optionsdlg.cc index d67fefa44..6cb8c521e 100644 --- a/gpsbabel/gui/optionsdlg.cc +++ b/gpsbabel/gui/optionsdlg.cc @@ -134,10 +134,8 @@ OptionsDlg::OptionsDlg(QWidget* parent, const QString& fmtName, QListsetChecked(getOptionValue(options_,k).toBool()); + // If it was selected before, select it again. + checkBox->setChecked(options_[k].getSelected()); w = 0; break; -- 2.30.2